Average Case Analysis of Java 7's Dual Pivot Quicksort
نویسندگان
چکیده
Recently, a new Quicksort variant due to Yaroslavskiy was chosen as standard sorting method for Oracle’s Java 7 runtime library. The decision for the change was based on empirical studies showing that on average, the new algorithm is faster than the formerly used classic Quicksort. Surprisingly, the improvement was achieved by using a dual pivot approach, an idea that was considered not promising by several theoretical studies in the past. In this paper, we identify the reason for this unexpected success. Moreover, we present the first precise average case analysis of the new algorithm showing e. g. that a random permutation of length n is sorted using 1.9n lnn − 2.46n + O(lnn) key comparisons and 0.6n lnn− 0.12n+O(lnn) swaps.
منابع مشابه
Average Case and Distributional Analysis of Java 7's Dual Pivot Quicksort
In 2009, Oracle replaced the long-serving sorting algorithm in its Java 7 runtime library by a new dual pivot Quicksort variant due to Yaroslavskiy. The decision was based on the strikingly good performance of Yaroslavskiy’s implementation in running time experiments. At that time, no precise investigations of the algorithm were available to explain its superior performance — on the contrary: P...
متن کاملPivot Sampling in Java 7's Dual-Pivot Quicksort
The new dual-pivot Quicksort by Vladimir Yaroslavskiy — used in Oracle’s Java runtime library since version 7 — features intriguing asymmetries in its behavior. They were shown to cause a basic variant of this algorithm to use less comparisons than classic single-pivot Quicksort implementations. In this paper, we extend the analysis to the case where the two pivots are chosen as fixed order sta...
متن کاملPivot Sampling in Dual-Pivot Quicksort
The new dual-pivot Quicksort by Vladimir Yaroslavskiy — used in Oracle’s Java runtime library since version 7 — features intriguing asymmetries in its behavior. They were shown to cause a basic variant of this algorithm to use less comparisons than classic single-pivot Quicksort implementations. In this paper, we extend the analysis to the case where the two pivots are chosen as fixed order sta...
متن کاملEngineering Java 7's Dual Pivot Quicksort Using MaLiJan
Recent results on Java 7’s dual pivot Quicksort have revealedits highly asymmetric nature. These insights suggest that asymmetric pivot choices are preferable to symmetric onesfor this Quicksort variant. From a theoretical point of view,this should allow us to improve on the current implementa-tion in Oracle’s Java 7 runtime library. In this paper, weuse our new tool MaLiJAn...
متن کاملWhy Is Dual-Pivot Quicksort Fast?
I discuss the new dual-pivot Quicksort that is nowadays used to sort arrays of primitive types in Java. I sketch theoretical analyses of this algorithm that offer a possible, and in my opinion plausible, explanation why (a) dual-pivot Quicksort is faster than the previously used (classic) Quicksort and (b) why this improvement was not already found much earlier.
متن کامل